include("TXG_Band_Structure.jl")
using LsqFit

th_inf = 2.2
Bx = 20
Efield = 0e8
w = [0.08, 0.1]
config = [0,1,0,1,0,1,0,1]
shift = [(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)]
anisotropy = 1
res = 100
maxK = 2
folder = mkpath("txg_2to5L_E$(Efield)_w$(w[1])_$(w[2])$(anisotropy==1 ? "" : "_ani$(anisotropy)")")

thlist=[1, 1.08, 1.57, 1.77, 1.81]

for Nlayer= 5

    # th = th_inf * cos(pi/(Nlayer+1)) * pi / 180
    th = thlist[Nlayer]/180*pi
    @show th*180/pi

    pyplot()

    (kx,ky,E,Ep,Dirac) = calcTXGBandsSquare(
        Nlayer,
        maxK,
        config,
        th,
        res,
        shift,
        Efield=Efield,
        title="theta=$(th)deg, E=$(Efield), layer=$(Nlayer)",
        Bin=[Bx,0],
        w=w,
        anisotropy=anisotropy,
        save="$(folder)/bands_$(Nlayer)L_Bx$(Bx)_th$(th*180/pi).txt"
        )


end
